package com.woniu.stafforder.controller;

import com.woniu.common.dto.OrderDto;
import com.woniu.common.util.PageParam;
import com.woniu.common.util.ResponseData;
import com.woniu.stafforder.entity.Order;
import com.woniu.stafforder.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     * 根据订单id修改订单状态
     * @param order
     * @return
     */
    @PostMapping("/updateOrderStatus")
    public Boolean updateOrderStatus(@RequestBody Order order) {
        return orderService.updateOrderStatus(order);
    }


    @PostMapping("/queryOrderList")
    public ResponseData<?> queryOrderList(@RequestBody PageParam<OrderDto> pageParam) {
        return orderService.queryOrderList(pageParam);
    }

    @GetMapping("/queryOrderByOrderNum/{orderNum}")
    public ResponseData<?> queryOrderByOrderNum(@PathVariable("orderNum") Long orderNum) {
        return orderService.queryOrderByOrderNum(orderNum);
    }
}